package gui;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * Created by Yaksha on 1/22/14.
 */
public class TabSelDialog extends JDialog {

    public TabSelDialog(final JFrame jFrame) {
        super(jFrame);
        setLayout(new FlowLayout(FlowLayout.CENTER));
        setTitle("Select Panel");
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);

        String[] listTab = {"Flow Panel",
                "Box Panel",
                "Border Panel",
                "Grid Panel",
                "Grid Bag Panel"};

        add(new JLabel("Select Panel:"));
        final JComboBox<String> jComboBox = new JComboBox<String>(listTab);
        add(jComboBox);

        JButton jButton = new JButton("Select");
        jButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                ((Screen) jFrame).setPanel((String) jComboBox.getSelectedItem());
                dispose();
            }
        });
        add(jButton);
        pack();
    }
}
